﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace SGLisp
{
    public class NSUnityEngine
    {
        NameSpace unityNameSpace;
        public NSUnityEngine() 
        {
            unityNameSpace = new NameSpace("unity");
            unityNameSpace.NameSpaceContext.Define("g-set-attr", new FunctionNode(_g_set_attr));
            unityNameSpace.NameSpaceContext.Define("g-get-attr", new FunctionNode(_g_get_attr));
        }

        ASTNode _g_get_attr(List<ASTNode> args, Context context)
        {
            args = CoreFunction.EvalArgs(args, context);
            GameObject g = (GameObject)((ObjectNode)args[0]).Val;
            string attrKey = ((KeywordNode)args[1]).Val;
            switch (attrKey)
            {
                case ":ActiveSelf":
                    return new BoolNode(g.activeSelf);
                case ":ActiveInHierarchy":
                    return new BoolNode(g.activeInHierarchy);
                case "active":
                    return new BoolNode(g.active);
            }
            return null;
        }
        ASTNode _g_set_attr(List<ASTNode> args, Context context)
        {

           return null;
        }
    }
}